All Questions
14 questions
4votes
2answers
4kviews
Calculate arithmetic expression represented by a string, in Java
I saw that interview question online and gave it a try: Implement a function that gets a string which represents an arithmethic expression: contains only numbers or the the operators: '+', '-', '*', '/...
6votes
3answers
3kviews
Reverse Polish Notation calculator with unit tests
I had an interview with a global company yesterday. They had given me a programming assignment. I shared my screen and I must have finished the task in 1.5 hours. Task was programming Reverse Polish ...
5votes
1answer
454views
Buy-sell order board, as a TDD interview
I recently did a technical test for a well known Bank in 'The City' and as a result got no further. They were also kind enough not to give me any feedback. The test entailed a TDD approach to a simple ...
4votes
1answer
189views
Are AVL trees equal? - revision 3
The original question Given two binary trees, return true if they are structurally identical, and false otherwise. Are AVL trees equal? Are AVL trees equal? - revision 2 This revision on GitHub ...
1vote
1answer
189views
Are AVL trees equal? - revision 2
Revision 1. This revision on GitHub In addition to the solution itself, I wrote tests for all the possible cases. It seems you have verified all execution paths are covered. You are right. ...
8votes
1answer
774views
Are AVL trees equal?
I was inspired by this answer and decided to implement an AVL tree with the methods equals and hashCode as if I was asked to do ...
5votes
1answer
229views
Swap items of a linked list in pairs - revision 5
Here is the source of the question. Given a singly linked list, swap the list items in pairs (reconnect the pointers, not simply swap the values). For example: Before: A->B->C->D After: ...
1vote
1answer
109views
Swap items of a linked list in pairs - revision 4
Here is the source of the question. The solution on GitHub. Revision 1. Revision 2. Revision 3. @200_success' suggestions from revision 3: The iterator's ...
2votes
1answer
96views
Swap items of a linked list in pairs - revision 3
Here is the source of the question. Revision 1. Revision 2. When I started the second round of code review, I wanted to make sure that I had included all the possible input types. However, I ...
3votes
1answer
184views
Swap items of a linked list in pairs - revision 2
The first revision is available here and the code is available on GitHub. I modified the method reversePairs and added mSize to ...
2votes
1answer
1kviews
Find pairs in an integer array whose sum == 10
I'm practicing for technical interviews and I'm looking for ways to improve my answers/code. Please point out the flaws you see and how I can make this better. Task: Find pairs in an integer array ...
11votes
2answers
35kviews
Bowling game scorer
I was given a simple coding exercise as part of a job interview process, for which I received a negative review. This is the question: DiUS is starting a bowling club. To help with the club, we ...
7votes
2answers
5kviews
Simple calculator for an interview
Question: Simple Calculator Input loaded from file. Instructions can be any binary operators. Ignore math precedence. Last input is apply and a number e.g. "apply 5". Calc is then initialized ...
6votes
2answers
5kviews
Ways to improve my coding test FizzBuzz solution for a TDD role?
I had an interview recently where I was asked to produce the traditional FizzBuzz solution: Output a list of numbers from 1 to 100. For all multiples of 3 and 5, the number is replaced with "...